<?php

/**
 * Enquete form.
 *
 * @package    form
 * @subpackage Enquete
 * @version    SVN: $Id: sfDoctrineFormTemplate.php 6174 2007-11-27 06:22:40Z fabien $
 */
class EnqueteForm extends BaseEnqueteForm
{
  	public function configure()
  	{
  		parent::configure();
		
  		$this->widgetSchema['ds_pergunta'] = new sfWidgetFormInput(
			array(),
			array('size'=>70, 'class'=>'required')
		);
		
  		$options = array('N'=>'Não', 'S'=>'Sim');
		$this->widgetSchema['st_enquete'] = new sfWidgetFormChoice(
			array('choices'=>$options, 'expanded'=>true, 'multiple'=>false)
		);
		
  		/*
       	 * Formulário embutido de Opções
       	 */
      	/*$form = new EnqueteOpcaoEnqueteForm(null, array(
			'enquete' => $this->getObject(),//nome do objeto
			'size'    => 20 //quantidade de registros
		));
        $this->embedForm('opcoes', $form);*/
        
  		$this->widgetSchema->setLabels(array(
  		   'id_enquete'  => 'ID#',
		   'ds_pergunta' => 'Pergunta',
		   'st_enquete'  => 'Publicar',
		   'slugenquete' => 'Slug',
		   'created_at'  => 'Criado em',
		   'updated_at'  => 'Atualizado em',
		));
  	}
  	
  	/*
	public function saveEmbeddedForms($con = null, $forms = null)
	{
		if (null === $forms)
		{
			$opcoes = $this->getValue('opcoes');
			$forms = $this->embeddedForms;
			foreach ($this->embeddedForms['opcoes'] as $name => $form)
			{
				if (!isset($opcoes[$name]))
					unset($forms['opcoes'][$name]);
			}
		}
		return parent::saveEmbeddedForms($con, $forms);
	}
	*/
}